296 research outputs found
Incremental copying garbage collection for WAM-based Prolog systems
The design and implementation of an incremental copying heap garbage
collector for WAM-based Prolog systems is presented. Its heap layout consists
of a number of equal-sized blocks. Other changes to the standard WAM allow
these blocks to be garbage collected independently. The independent collection
of heap blocks forms the basis of an incremental collecting algorithm which
employs copying without marking (contrary to the more frequently used mark©
or mark&slide algorithms in the context of Prolog). Compared to standard
semi-space copying collectors, this approach to heap garbage collection lowers
in many cases the memory usage and reduces pause times. The algorithm also
allows for a wide variety of garbage collection policies including generational
ones. The algorithm is implemented and evaluated in the context of hProlog.Comment: 33 pages, 22 figures, 5 tables. To appear in Theory and Practice of
Logic Programming (TPLP
Improving Prolog programs: Refactoring for Prolog
Refactoring is an established technique from the object-oriented (OO)
programming community to restructure code: it aims at improving software
readability, maintainability and extensibility. Although refactoring is not
tied to the OO-paradigm in particular, its ideas have not been applied to Logic
Programming until now.
This paper applies the ideas of refactoring to Prolog programs. A catalogue
is presented listing refactorings classified according to scope. Some of the
refactorings have been adapted from the OO-paradigm, while others have been
specifically designed for Prolog. The discrepancy between intended and
operational semantics in Prolog is also addressed by some of the refactorings.
In addition, ViPReSS, a semi-automatic refactoring browser, is discussed and
the experience with applying ViPReSS to a large Prolog legacy system is
reported. The main conclusion is that refactoring is both a viable technique in
Prolog and a rather desirable one.Comment: To appear in Theory and Practice of Logic Programming (TPLP
TOR: modular search with hookable disjunction
Horn Clause Programs have a natural exhaustive depth-first procedural
semantics. However, for many programs this semantics is
ineffective. In order to compute useful solutions, one needs the
ability to modify the search method that explores the alternative
execution branches.
Tor, a well-defined hook into Prolog disjunction, provides this ability.
It is light-weight thanks to its library approach and efficient
because it is based on program transformation.
Tor is general enough to mimic search-modifying
predicates like ECLiPSe's search/6. Moreover, Tor supports
modular composition of search methods and other hooks.
The Tor library is already
provided and used as an add-on to SWI-Prolog.publisher: Elsevier
articletitle: Tor: Modular search with hookable disjunction
journaltitle: Science of Computer Programming
articlelink: http://dx.doi.org/10.1016/j.scico.2013.05.008
content_type: article
copyright: Copyright © 2013 Elsevier B.V. All rights reserved.status: publishe
Delimited continuations for Prolog
Delimited continuations are a famous control primitive that originates in the functional programming world. It allows the programmer to suspend and capture the remaining part of a computation in order to resume it later. We put a new Prolog-compatible face on this primitive and specify its semantics by means of a meta-interpreter. Moreover, we establish the power of delimited continuations in Prolog with several example definitions of high-level language features. Finally, we show how to easily and effectively add delimited continuations support to the WAM
Delimited continuations in Prolog: semantics, use, and implementation in the WAM
An implementation of a delimited continuations, known in the functional programming world, is shown in the context of the WAM, and more particular in hProlog. Three new predicates become available to the user: reset/3 and shift/1 for delimiting and capturing the continuation, and call continuation/1 for calling it. The underlying low-level built-ins and modifications to the system are described in detail. While these do not turn continuations into first-class Prolog citizens, their usefulness is shown in a series of examples. The idea behind this implementation can be adapted to other Prolog implementations. The constructs are compared with similar ones in BinProlog and Haskell. Their interaction with other parts of Prolog is discussed
The State of Utah v. Joshua Jacob St. Clair : Brief of Appellant
APPEAL FROM JUDGMENT, SENTENCE (COMMITMENT) OF THIRD JUDICIAL DISTRICT COURT OF TOOELE COUNTY HONORABLE JOHN A. ROKIC
- …